Engine Exception
open class EngineException(message: String, val code: String = "", val category: String = "", val hint: String = "", docs: String = "", val args: Map<String, Any> = emptyMap(), val silent: Boolean = false) : RuntimeException
Structured engine error surfaced from the native side.
The structured fields (code, category, hint, docsUrl, args, silent) are populated from the engine's error catalog. Every engine error carries a stable, non-empty code; as a defensive measure code may be empty — treat it the same as any other unrecognized code rather than crashing on it.
Existing callers that only read message keep working — the new fields have default values preserving the previous source compatibility of EngineException(message).
try {
engine.scene.create()
} catch (e: EngineException) {
when (e.code) {
"SCENE.NOT_VALID" -> toast("No scene is loaded.")
else -> toast(e.message ?: "Unknown error")
}
e.docsUrl?.let { openBrowser(it) }
}Content copied to clipboard